<?php 
namespace app\common\model;
class Media extends Common{
	protected $insert = ['addtime'=>SYS_TIME];
	protected function getAddtimeAttr($value){
		
		return date("Y-m-d H:i", $value);
	}
	protected function getStatusnameAttr($value,$data){
		
		return $data['status'] ? "显示" : "隐藏";
	}
	protected function getThumbAttr($value, $data){
		if(strpos($value,"http://") !== false){
			return $value;
		}
		else{
			return $value ? APP_URL.'/'.$value : '';
		}
	}
	protected function getLinkurlAttr($value){
		return $value ? $value : 'www.baidu.com';
	}
	protected function getAlldataAttr($value, $data){
		$arr = [0=>'隐藏',1=>'显示'];
		$data['statusname'] = $arr[$data['status']];
		$data['dealer'] = model('AdminUser')->where('userid', $data['userid'])->value('realname');
		$data['addtime'] = date("Y-m-d H:i:s", $data['addtime']);
		return $data;
	}
}